package com.msh.artascope.devcloud.client.po;


import com.msh.artascope.interfaces.ILoginAccount;
import com.msh.frame.client.base.BasePo;
import com.msh.frame.client.validation.IInsertVo;
import com.msh.frame.client.validation.IUpdateVo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * @author shihu
 * @mail m-sh@qq.com
 */
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Schema(name = "默认资源Po")
public class DefalutResourcePo extends BasePo{
  @NotNull(groups = {IUpdateVo.class}, message = "id不能为空")
  @Schema(name = "主键")
  private Long id;

  @NotNull(groups = {IInsertVo.class},message = "最小内存不能为空")
  @Schema(name = "最小内存")
  private Integer minMem;

  @NotNull(groups = {IInsertVo.class},message = "最大内存不能为空")
  @Schema(name = "最大内存")
  private Integer maxMem;

  @Size(groups = {IUpdateVo.class,IInsertVo.class},max = 500, message = "javaArgs长度范围最大500")
  @Schema(name = "java参数")
  private String javaArgs;

  @NotNull(groups = {IInsertVo.class},message = "实例数不能为空")
  @Schema(name = "实例数")
  private Integer replicasNum;

  @NotNull(groups = {IInsertVo.class},message = "硬盘大小不能为空")
  @Schema(name = "硬盘大小")
  private Integer diskSize;

  @NotNull(groups = {IInsertVo.class},message = "环境不能为空")
  @Schema(name = "环境")
  private Long envId;

  @Schema(name = "租户")
  private Long tenantId;

  @NotNull(groups = {IUpdateVo.class}, message = "更新版本不能为空")
  @Schema(name = "更新版本")
  private Integer updateVersion;



  public void initLoginAccount(ILoginAccount loginAccount){
    this.tenantId = loginAccount.getTenantId();
  }
}



